/** 表数据处理控件 * */
document.write('<script type="text/javascript" src="' + context
		+ '/system/tablequery/js/tablehandler.js"></script>');

function renderTQExtListHeader(value, cellmeta, record, rowIndex, columnIndex,
		store) {
	var cm = getGridCm('myghlist');
	var fieldName = cm.getDataIndex(columnIndex);

	if (fieldName == 'LYDATE') {
		return formatDate(value);
	} else if (fieldName == 'LYSTATUS') {
		if (value == '2') {
			return ('<font color="red">未归还</font>');
		} else if (value == '3') {
			return ('已归还');
		}
	} else if (fieldName == 'SP') {
		if (record.get('LYSTATUS') == '2') {
			return '<a href="javascript:void(0);" onclick="javascript:handleSP(\''
					+ record.get('PKID') + '\');">归还</a>';
		} else {
			return '';
		}
	}

	return value;
}

/**
 * 报修申请审批
 * 
 * @param {}
 *            id
 */
function handleSP(id) {
	updateTable('APP_GDZC_LY', 'single', '-1', function() {
				createHidden('PKID', id);
				createHidden('LYSTATUS', '3');
				return true;
			}, function() {
				reloadTQList('myghlist');
			}, '确定归还资产？', 'gzreturn');
}